<?php

$opmServers[] = 'http://rogerxu-opm.appspot.com/';
$opmServers[] = 'http://server4.operamini.com/';
$opmServers[] = 'http://demo.opera-mini.net:9002/';
$opmServers[] = 'http://google-cust.opera-mini.net/';
$opmServers[] = 'http://global-4-lvs-usa.opera-mini.net/';
$opmServers[] = 'http://p09-15.opera-mini.net/';
$opmServers[] = 'http://r01-15.opera-mini.net/';
$opmServers[] = 'http://r03-15.opera-mini.net/';

$opmServer = $opmServers[0];

if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    if (function_exists("curl_init")) {
        if ($_GET["test"] == null) {
            header( "HTTP/1.1 301 Moved Permanently" );
            header( "Location: http://www.google.com/search?hl=en&safe=off&q=opera+mini+mod" );
        } else {
            echo '<h3>Hello Opera Mini Server! Fuck GFW!</h3>' . '<br />' . "\n";
            echo 'Servers:' . '<br />' . "\n";
            echo '<pre>' . "\n";
            print_r($opmServers);
            echo '</pre>' . "\n";
            echo '<br />' . "\n";
            echo 'Current Server: ' . $opmServer;
        }
    } else {
        echo 'cURL is not enabled.';
    }
} else {
    $curlInterface = curl_init();
    $headers[] = 'Connection: Keep-Alive';
    $headers[] = 'content-type: application/xml';
    $headers[] = 'User-Agent: Java0';
    curl_setopt_array($curlInterface, array(
        CURLOPT_URL => $opmServer,
        CURLOPT_HTTPHEADER => $headers,
        CURLOPT_POST => 1,
        CURLOPT_POSTFIELDS => @file_get_contents('php://input') // @ => error control operator, any error messages that might be generated by that expression will be ignored. 
    ));
    $result = curl_exec($curlInterface);
    curl_close($curlInterface);
    //header('Content-Type: application/octet-stream');
    //header('Cache-Control: private, no-cache');
    echo $result;
}
?>
